Most computer memory systems are designed using a specific number of bits to address memory locations. For example, if 8 bits are used for addressing, then 2.sup.8 or 256, memory addresses are available. Increasing the number address of bits increases the number or addressable memory locations. Memory addressing schemes are typically linear or segmented. A linear addressing scheme uses a computer memory address register of a certain number of bits (e.g. 32 bits), to determine actual physical memory locations. When the memory address register is incremented, the next memory location is determined. A segmented memory address scheme uses a memory address register as well as segment registers to determine a memory location, and physical memory is often logically arranged and accessed by memory segments of a predetermined size. The segment registers are typically the same number of bits as the memory address register, (e.g. 16-bits). However, the, segment registers are shifted (e.g. to the left) some number of bits (e.g. 4-bits) and then the values the segment registers contain are added to a memory address register to form a segmented memory address. In a segmented memory scheme, the contents of a segment register and a memory address register are added together to obtain a memory address location. Both contents are needed to form the complete address, unlike the flat or linear address scheme.
Many 16-data bit and 32-data bit computer systems used today were developed from earlier 8-data bit computer systems that incorporated the 8080 microprocessor manufactured by the Intel Corporation of Santa Clara, Calif. These early 8-bit computer systems used a 16-bit register to address memory. A 16-bit address space allows 2.sup.16 or 65,536 total memory addresses, which is commonly called a 64K memory address space (since 1K is defined as 2.sup.10 or 1024 bytes). When the first 16-data bit computer systems were developed using the Intel 8086 microprocessor, the 16-bit memory address scheme was kept for backward compatibility with earlier hardware and software products, such as those that were developed around the Intel 8080.
To keep the 16-bit address scheme but allow for addressing a memory size larger than 64K, the Intel 8086 processor added four segment registers. The 8086 segment registers were 16 bits each. The 16 bits of a segment register are shifted to the left by 4 bits and combined with 16 bits of the address register to form a unique 20-bit address. A 20-bit address, 2.sup.20, gives 1,048,576 memory addresses or one megabyte of memory address space.
When the first personal computers (PCs) using the Intel 8086 were developed by IBM, it was decided to reserve 384K of the potential one megabyte memory address space for system hardware and software purposes. That left about 640K (1 MB-384K) of memory address space free for use by the computer operating system and application programs. This 640K memory limit was built into the first disk operating system, called MS-DOS, designed and developed by Microsoft.TM., for Intel 8086-based computers. As a result, application programs running under MS-DOS programs can only use the 640K of available memory.
When Intel created the 80286 microprocessor, it was designed to operate in one of two distinct modes called the real-mode and the protected mode. First, it could run in a mode to be backward compatible with the 8086 which is called the real-mode. Second, it could run in advanced mode to take advantage of the new processor's advanced capabilities called protected-mode. Operating systems running on the 80286 were capable of switching the 80286 between real-mode and protected-mode (i.e. between the two distinct modes).
In real-mode, the processor uses the 8086 20-bit, one mega-byte memory address scheme. However, in protected-mode starting with the 80286, segments registers are no longer simply shifted left four bits and added to a given address as they are in real-mode (or the virtual-8086-mode introduced with the 80386 processor). Segment registers are indexes into a descriptor table and each entry in the descriptor table contains a 24-bit (or 32-bit in the case of 80386 and later processors) base address that is then added to a given memory address. In the 80286, the segment register selects a descriptor from the descriptor table yielding a 24-bit base address, to which a 16-bit memory address is added, yielding a final 24-bit memory address. A 24-bit memory address space allows 2.sup.24 memory addresses, or about 16.7 megabytes of memory.
Protected-mode offers several advantages over real-mode. These include a 24-bit memory address space, memory protection and the capability for the operating system to use any suitable area of physical memory as a segment. Thus, with the memory protection an operating system can set up an environment in which several programs run concurrently, each in its own protected memory area. And the memory segments of a program no longer needed to be contiguous and can vary in size. A program does not have to know where its memory segments are located in actual physical memory.
When the 80386 microprocessor was introduced by Intel, the notion of memory segments in real-mode was again kept for backwards compatibility. However, the 80386 also has 32-bit memory for addressing up to 2.sup.32 or 4 gigabytes of memory. In fact, a single segment can be up to 4 gigabytes in size, and a program can use the 80386 as though it had a linear address space.
Memory on the 80386 and later processors is divided up into 4 kilo-byte (4K) memory pages. Memory pages are the building blocks of every application that would be run using the 80386 or later processor. For example, the Windows.TM. operating system by Microsoft.TM. uses memory pages as the building blocks of every MS-DOS virtual machine that is created to run under Windows.TM.. A MS-DOS virtual machine is a replication of a computer running MS-DOS in the real-mode even though it is executed in the virtual-8086-mode that is described below. Windows.TM. needs a minimum of 160 4 kilo-byte pages of physical memory to construct a 640K virtual machine (i.e. the 640K available memory area of the 1 MB address space described above).
A new operating mode called virtual-mode or "virtual-8086-mode" was also introduced with the 80386. Virtual-mode allows several concurrently running real-mode programs to share physical memory of the computer. The 80386 also provides protection of physical devices and unauthorized access to programs from other programs running concurrently in the system. The Intel 80486 microprocessor and the Pentium.RTM. microprocessor have further changed the processor hardware, but have preserved the 1 MB (384K+640K) memory layout backward compatibility.
As a result of the changes in the Intel processor architecture and the need for backward compatibility, software programs designed to run under MS-DOS have to be compatible with the 8086 and the one megabyte memory layout as described above. With only 640K of memory generally available to run real-mode based applications, many software developers have devised ways to reclaim memory to use more than 640K. Many commercial products called DOS memory managers have been developed, such as QEMM, by Quarterdeck, Office Systems Inc. of Santa Monica, Calif. and 386 Max by Qualitis of Bethesda, Md. These products try to increase the amount of memory available for existing MS-DOS-based applications by moving other software into expanded memory, extended memory, high memory, and other types of memory.
A DOS memory manager typically will increase the amount of memory available by switching the processor from the real-mode to the virtual-8086-mode, and use the processor's paging capability to map pages of extended memory (i.e. memory from outside the 1 MB range) into unused regions within the 1 MB range. For example, there are often unused areas in the 384K reserved portion in the 1 MB area that DOS memory managers can use a repositories for additional MS-DOS addressable memory.
Many operating systems such as Windows.TM. run in protected-mode, but still enable MS-DOS applications to run in virtual-8086-mode (the equivalent of real-mode). For example, Windows 3.x allows the use of many different kinds of real-mode applications programs, such as compilers, database programs, etc., as well as protected-mode programs and device drivers, all running simultaneously.
A disadvantage with respect to memory usages with applications that run in protected-mode is that they may include protected-mode device drivers that duplicate the functions of device drivers that run in real-mode. When the protected-mode application boots, essentially two copies of that device driver are loaded into memory, unnecessarily consuming this valuable resource. Another disadvantage is that the memory occupied by the real-mode drivers must be replicated in every MS-DOS virtual-machine spawned by a protected-mode application, which means every MS-DOS virtual-machine has less available memory than it might otherwise have.
Attempts have been made to solve the real-mode memory consumption problem. QuarterDeck Office Systems, Inc. has a feature in its QEMM product called "Stealth DoubleSpace," which swaps MS-DOS real-mode DoubleSpace driver in and out of memory as it is needed by a program running in the protected-mode. A disadvantage to this approach is that the DOS driver may have to be swapped many times, making use of the driver slower than normally would be expected. Another disadvantage to this approach is that applications may already have protected-mode device drivers that duplicate real-mode device drivers, making the swapping unnecessary.
An object of the present invention, therefore, is to temporarily or permanently remove real-mode based software components such as device drivers that are duplicated by protected-mode software components when an application that runs in the protected-mode boots. Removing real-mode components duplicated by the protected-mode reclaims substantial amounts of memory, thereby increasing the maximum available memory to be used for real-mode and other protected-mode applications. When the protected-mode application quits, the real-mode based software components are restored to their original state and location in memory so that the computer system can successfully return to the real-mode.